<%@page language="abap"%>
<%@extension name="htmlb" prefix="htmlb"%>

<html>

<head>

<script>

window.onload = function(){

  // pass all querystring variables to BOI openreport
  // THIS IS A BSP PROCESS
  // sample request to this bsp:
  // open_report.htm?id=12323&type=BO&target=_blank&VAR_1=value&VAR_2=eeee&somevar=value&...
  var vars = ""; //this object will hold the variables and their values
      var params = { "id":"", "type":"", "target":"" };
      var varsCollection = new Array();
<%



      data :
       WA_FIELDS like line of FIELDS,
       name type string,
       val type string,
       url type string.

" if the id is not there, then promit for an error message
" fire an alert for now.

loop at FIELDS into WA_FIELDS.

  name = WA_FIELDS-name.
  val = cl_http_utility=>escape_html( WA_FIELDS-value ).
  name = cl_http_utility=>escape_html( name ).



*  if val ns '<' or val ns '>'.
*
*    val = cl_http_utility=>escape_url( val ).
*    val = cl_http_utility=>unescape_url( val ).
*    val = cl_http_utility=>escape_html( val ).
*  endif.
  %>
    varsCollection.push({"name":"<%= name%>","value":"<%= val%>"});

  <%
endloop.
%>

for( var i in varsCollection){
    if ( varsCollection[i].name === "id"  ||
         varsCollection[i].name === "target"   ||
         varsCollection[i].name === "type" )
    {
       params[varsCollection[i].name] = varsCollection[i].value;
    }
    else{
       vars += "&" + varsCollection[i].name + "=" + varsCollection[i].value;
    }
}
  if( parent.BOI ){
    parent.BOI.openReport(params["id"], params["type"],vars,true,params["target"]);
  }
  //use bsp loop code to generate javascript syntax similar to this example:
  //vars["..."] = "...";
  //and so on for all passed parameters etc..
  //IMPORTANT: do not include these parameters in the array: id,type,target



}

</script>
<title></title>
</head>

<body>

</body>
</html>
